package com.zxmc.server.mapper;

import com.zxmc.pojo.entity.Author;
import com.zxmc.pojo.entity.BookShelf;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookShelfMapper {

//    @Select("select * from bookshelf where  novel_id= #{novelId} and user_id=#{userId}")
    List<BookShelf> list(@Param("userId") Integer userId , @Param("novelId") Integer novelId);

//    @Insert("insert into bookshelf()" +
//            " values (#{userId},#{novelId},#{lastRead},#{lastReadTitle},#{total},#{lastReadTime}," +
//            "#{addedTime},#{lastReadContent},#{title},#{cover},#{author});")
    @Insert("insert into bookshelf(user_id, novel_id, last_read, last_read_title, total, chapter_total,last_read_time, added_time, last_read_content, title, cover, author)" +
            " values (#{userId},#{novelId},#{lastRead},#{lastReadTitle},#{total},#{chapterTotal},#{lastReadTime},#{addedTime},#{lastReadContent},#{title},#{cover},#{author});")
    void insert(BookShelf bookShelf);


    void delete(BookShelf bookShelf);

    void update(BookShelf bookShelf);
}
